package com.gilly;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class InsertServiceServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		ArrayList<MemberDTO> list = new ArrayList<MemberDTO>();
		MemberDTO dto = null;
		MemberDAO dao = null;
		String id = (String) request.getAttribute("id");
		String password = (String) request.getAttribute("password");
		String name = (String) request.getAttribute("name");
		String address = (String) request.getAttribute("address");
		String email = (String) request.getAttribute("email");
		String phone1 = (String) request.getAttribute("phone1");
		String phone2 = (String) request.getAttribute("phone2");
		String phone3 = (String) request.getAttribute("phone3");
		dto = new MemberDTO(id, password, name, address, email, phone1, phone2, phone3);
		list.add(dto);
		
		dao = new MemberDAO();
		dao.insert(list);
		
	}
}
